from appengine_django.models import BaseModel
from google.appengine.ext import db
import logging

from common.fields import UTCDateTimeProperty

class User(BaseModel):
    first_name = db.StringProperty()
    second_name = db.StringProperty()
    email = db.EmailProperty()
    password = db.StringProperty()

class Staff(User):
    pass

class School(BaseModel):
    name = db.StringProperty()
    stage = db.StringProperty()
    manager = db.StringProperty()

class Teacher(User):
    favorite_classroom = db.StringProperty()

class Troble(BaseModel):
    note = db.TextProperty()
    fixed = db.BooleanProperty(default=False)
    check_time = db.DateTimeProperty(auto_now=True)

class Clazz(BaseModel):
    date = db.DateProperty(auto_now=True)
    start_time = db.DateTimeProperty(auto_now=True)
    end_time = db.DateTimeProperty(auto_now=True)
    teacher = db.ReferenceProperty(Teacher)
    school = db.ReferenceProperty(School)
    finished = db.BooleanProperty()
    troble = db.ReferenceProperty(Troble)

class InternetRate(BaseModel):
    date = db.DateTimeProperty(auto_now=True)
    seoul = db.StringProperty()
    brisbane = db.StringProperty()
    loss = db.FloatProperty(default=0.0)
    min = db.FloatProperty(default=0.0)
    avg = db.FloatProperty(default=0.0)
    max = db.FloatProperty(default=0.0)
